<?php
/**
 * @Notes:【】
 * @User: zwc
 * @Date: 2022-05-04 13:31
 */

namespace App\Controller\User\Task;

use App\Controller\User\BaseController;
use App\Middleware\AuthTokenMiddleware;
use App\Service\Task\TaskReportService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Middleware;
use Yj\Apidog\Annotation\ApiController;
use Yj\Apidog\Annotation\FormData;
use Yj\Apidog\Annotation\PostApi;

/**
 * @Notes:【】
 * @User: zwc
 * @Date: 2022-05-04 13:31
 * @Middleware(AuthTokenMiddleware::class)
 * @ApiController(prefix="user/task/task-report")
 */
class TaskReportController extends BaseController
{

    /**
     * @Inject()
     * @var TaskReportService
     */
    protected $taskReportService;

    /**
     * @return void
     * @PostApi(path="lists")
     * @FormData(key="type",default="0")
     */
    public function lists(){
        $uid = $this->getUid();
        $type = $this->getParams()->get('type');
        $data = $this->taskReportService->listsByType($uid,$type);
        _SUCCESS($data);
    }
    /**
     * @Notes:【】
     * @Date: 2022-06-04 2:33
     * @PostApi("add")
     * @FormData(key="content")
     * @FormData(key="image")
     * @FormData(key="types")
     */
    public function add()
    {
        $data = $this->getData();
        $this->taskReportService->add($data);
        _SUCCESS();
    }

}